﻿if not ArmorCraft_revision then ArmorCraft_revision = {} end
ArmorCraft_revision.euUS	= ("$Revision: 121 $"):match("(%d+)")

-- Local function prototypes

-- Binding Configuration
BINDING_HEADER_ARMORCRAFT    = "ArmorCraft"
BINDING_NAME_ARMORCRAFTFRAME = "Toggle ArmorCraft window"

-- Item types
AC_ARMOR		= _G[ARMOR]
AC_WEAPON	= "Weapon"

-- Armor types
AC_CLOTH   	= 'Cloth'
AC_LEATHER 	= 'Leather'
AC_MAIL    	= 'Mail'
AC_PLATE   	= 'Plate'
AC_SHIELD  	= 'Shield'
AC_SHIELDS 	= 'Shields'
AC_LIBRAMS	= 'Librams'
AC_IDOLS		= 'Idols'
AC_TOTEMS	= 'Totems'

-- Player classes
AC_DEATHKNIGHT	= 'Death Knight'
AC_DRUID   		= 'Druid'
AC_HUNTER  		= 'Hunter'
AC_MAGE    		= 'Mage'
AC_PALADIN 		= 'Paladin'
AC_PRIEST  		= 'Priest'
AC_ROGUE   		= 'Rogue'
AC_SHAMAN  		= 'Shaman'
AC_WARLOCK 		= 'Warlock'
AC_WARRIOR 		= 'Warrior'

-- Mappings
ArmorCraft_TS = {Blacksmithing=AC_MAIL, Leatherworking=AC_LEATHER, Tailoring=AC_CLOTH, Engineering=AC_CLOTH, Jewelcrafting=AC_CLOTH, Inscription=AC_CLOTH }
ArmorCraft_Class = {
						  	[AC_MAGE]			= AC_CLOTH;
						  	[AC_PRIEST]			= AC_CLOTH;
						  	[AC_WARLOCK]		= AC_CLOTH;
                     [AC_DRUID]			= AC_LEATHER;
                     [AC_ROGUE]			= AC_LEATHER;
                     [AC_HUNTER]			= AC_LEATHER;
                     [AC_SHAMAN]			= AC_LEATHER;
                     [AC_PALADIN]		= AC_MAIL;
                     [AC_WARRIOR]		= AC_MAIL;
                     [AC_DEATHKNIGHT]	= AC_PLATE;
}



ArmorCraft_Class2 = {[AC_HUNTER]=AC_MAIL; [AC_SHAMAN]=AC_MAIL; [AC_PALADIN]=AC_PLATE; [AC_WARRIOR]=AC_PLATE}
ArmorCraft_Dual = {[AC_HUNTER]=20; [AC_ROGUE]=10; [AC_WARRIOR]=20}

-- Best armor types possible for classes i.e. if you can wear the one to the right, you can wear all of them.
ArmorCraft_Types = {[AC_CLOTH] = true, [AC_LEATHER] = true, [AC_SHIELDS] = true, [AC_MAIL] = true, [AC_PLATE] = true}

-- Armor location names and IDs
AC_MAIN   		= 'Main Hand'
AC_ONE    		= 'One-Hand'
AC_TWO    		= 'Two-Hand'
AC_OFF    		= 'Off Hand'
AC_HELD   		= 'Held In Off-hand'
AC_HELD_SHORT	= "Held In OH"
AC_RANGED 		= 'Ranged'
AC_BACK   		= 'Back'
AC_NECK   		= 'Neck'
AC_FINGER 		= 'Finger'
AC_FINGER2		= 'Finger 2'
AC_TRINKET		= 'Trinket'
AC_TRINKET2		= 'Trinket 2'
AC_MHSLOT 		= 'MainHandSlot'
AC_SHSLOT 		= 'SecondaryHandSlot'
ArmorCraft_Loc= {		-- Paperdoll slot names				AC_FrameTemplate ID  Paperdoll slot ID
    Head=				{slot='HeadSlot',										ID=1,		SlotID=1};
    Shoulder=			{slot='ShoulderSlot',								ID=2,		SlotID=3};
    [AC_BACK]=			{slot='BackSlot',										ID=3,		SlotID=15};
    Chest=				{slot='ChestSlot',									ID=4,		SlotID=5};
    Wrist=				{slot='WristSlot',									ID=5,		SlotID=9};
    Hands=				{slot='HandsSlot',									ID=6,		SlotID=10};
    Waist=				{slot='WaistSlot',									ID=7,		SlotID=6};
    Legs=				{slot='LegsSlot',										ID=8,		SlotID=7};
    Feet=				{slot='FeetSlot',										ID=9,		SlotID=8};
    [AC_MAIN]=			{slot=AC_MHSLOT,		slot1=AC_SHSLOT,			ID=10,	SlotID=16};
    [AC_OFF]=			{slot=AC_SHSLOT, 										ID=11,	SlotID=17};
    [AC_HELD]=			{slot=AC_SHSLOT,													SlotID=17};
    [AC_RANGED]=		{slot='RangedSlot',									ID=12,	SlotID=18};
    [AC_FINGER]=		{slot='Finger0Slot',	slot1='Finger1Slot',		ID=13,	SlotID=11};
    [AC_FINGER2]=		{slot='Finger1Slot',									ID=14,	SlotID=12};
    [AC_NECK]=			{slot='NeckSlot',										ID=15,	SlotID=2};
    [AC_TRINKET]=		{slot='Trinket0Slot',slot1='Trinket1Slot', 	ID=16,	SlotID=13};
    [AC_TRINKET2]=	{slot='Trinket1Slot', 								ID=17,	SlotID=14};
};

-- Armor attribute values
AC_OTHER = 'Other'
--[[
ArmorCraft_Attr = {[AC_MAGE]={ Agility=3, Intellect=3, Spirit=3, Stamina=3, Strength=1, [AC_OTHER]=1 };
                 [AC_PRIEST]={ Agility=3, Intellect=5, Spirit=6, Stamina=3, Strength=1, [AC_OTHER]=1 };
                [AC_WARLOCK]={ Agility=3, Intellect=3, Spirit=2, Stamina=2, Strength=1, [AC_OTHER]=1 };
                  [AC_DRUID]={ Agility=4, Intellect=2, Spirit=3, Stamina=3, Strength=2, [AC_OTHER]=1 };
                  [AC_ROGUE]={ Agility=7, Intellect=1, Spirit=2, Stamina=3, Strength=3, [AC_OTHER]=1 };
                 [AC_HUNTER]={ Agility=6, Intellect=2, Spirit=2, Stamina=2, Strength=2, [AC_OTHER]=1 };
                 [AC_SHAMAN]={ Agility=4, Intellect=2, Spirit=3, Stamina=3, Strength=3, [AC_OTHER]=1 };
                [AC_PALADIN]={ Agility=5, Intellect=2, Spirit=2, Stamina=3, Strength=4, [AC_OTHER]=1 };
                [AC_WARRIOR]={ Agility=5, Intellect=1, Spirit=1, Stamina=3, Strength=4, [AC_OTHER]=1 }}
]]--
AC_Formula = {
	-- Inspired by http://elitistjerks.com/f47/t36638-death_knight_pve_dps/
	["Death Knight : Unholy"]
						= "7.56*DPS+ATTACKPOWER+2.48*STR+2.47*CR_HIT+.54*APR+1.39*CR_EXPERTISE+1.12*CR_CRIT+.62*CR_HASTE+.1*AC+.35*AGI+.5*STA+.07*CR_DODGE+.07*CR_PARRY+.05*CR_DEFENSE+.03*BLOCKVALUE+.05*CR_BLOCK+1.4*EMPTY_SOCKET_BLUE+2.8*EMPTY_SOCKET_RED+2.3*EMPTY_SOCKET_YELLOW+12*EMPTY_SOCKET_META",
	["Death Knight : Blood"]
						= "8.97*DPS+ATTACKPOWER+2.56*STR+2.66*CR_HIT+1.05*APR+1.70*CR_EXPERTISE+1.15*CR_CRIT+.56*CR_HASTE+.1*AC+.35*AGI+.5*STA+.07*CR_DODGE+.07*CR_PARRY+.05*CR_DEFENSE+.03*BLOCKVALUE+.05*CR_BLOCK+1.4*EMPTY_SOCKET_BLUE+2.8*EMPTY_SOCKET_RED+2.3*EMPTY_SOCKET_YELLOW+12*EMPTY_SOCKET_META",
	["Death Knight : Frost"]
						= "10.36*DPS+ATTACKPOWER+2.37*STR+2.4*CR_HIT+.76*APR+1.25*CR_EXPERTISE+1.19*CR_CRIT+.5*CR_HASTE+.1*AC+.35*AGI+.5*STA+.07*CR_DODGE+.07*CR_PARRY+.05*CR_DEFENSE+.03*BLOCKVALUE+.05*CR_BLOCK+1.4*EMPTY_SOCKET_BLUE+2.8*EMPTY_SOCKET_RED+2.3*EMPTY_SOCKET_YELLOW+12*EMPTY_SOCKET_META",

	["Druid"]		= "4*AGI+2*INT+3*SPI+3*STA+2*STR+AC/5",
	["Druid Feral Leveling"]
						= "",
	["Druid Feral DPS"]
						= "AGI*2.6+STR*2.4+CR_EXPERTISE*1.6+CR_CRIT*1.55+CR_HIT*1.55+ATTACKPOWER+STA*.3+SPI*.25+CR_HASTE*1.37+AC/20",
	["Mage"]			= "INT+.1*SPI+.1*STA+.23*CR_CRIT+.534*CR_HIT+.267*CR_HASTE+.359*SPELLPOWER+.05*CR_RESILIENCE+4.2*EMPTY_SOCKET_BLUE+9*.359*EMPTY_SOCKET_RED+8*EMPTY_SOCKET_YELLOW+14*EMPTY_SOCKET_META",
	["Mage Wand"]	= "DPS*.25+INT+.1*SPI+.1*STA+.23*CR_CRIT+.534*CR_HIT+.267*CR_HASTE+.359*SPELLPOWER+.05*CR_RESILIENCE+4.2*EMPTY_SOCKET_BLUE+9*.359*EMPTY_SOCKET_RED+8*EMPTY_SOCKET_YELLOW+14*EMPTY_SOCKET_META",
	["Mage Fire"]	= "INT+.1*SPI+.1*STA+.23*CR_CRIT+.506*CR_HIT+.345*CR_HASTE+.361*(SPELLPOWER+FIREDMG)+.05*CR_RESILIENCE+9*.361*EMPTY_SOCKET_RED+8*EMPTY_SOCKET_YELLOW+14*EMPTY_SOCKET_META",
	["Mage Frost"]	= "INT+.1*SPI+.1*STA+.23*CR_CRIT+.575*CR_HIT+.419*CR_HASTE+.411*(SPELLPOWER+FROSTDMG)+.05*CR_RESILIENCE+9*.411*EMPTY_SOCKET_RED+8*EMPTY_SOCKET_YELLOW+14*EMPTY_SOCKET_META",
	["Mage Arc"]	= "INT+.1*SPI+.1*STA+.23*CR_CRIT+.667*CR_HIT+.219*CR_HASTE+.445*(SPELLPOWER+ARCANEDMG)+.05*CR_RESILIENCE+9*.445*EMPTY_SOCKET_RED+8*EMPTY_SOCKET_YELLOW+14*EMPTY_SOCKET_META",
	["Priest"]		= "3*AGI+10*INT+10*SPI+3*STA+ARMOR/10+10*CR_CRIT+10*CR_HIT+10*CR_HASTE+10*SPELLPEN+35*MANAREG+5*SPELLPOWER",
	["Holy Priest"]
						= "DPS/5+math.max(SPELLPOWER,HEAL)+SPI*2.57+MANAREG*5.14+INT*1.33+CR_CRIT+STA+19.3*EMPTY_SOCKET_BLUE+19.3*EMPTY_SOCKET_RED+14*EMPTY_SOCKET_YELLOW+40*EMPTY_SOCKET_META",
	["Shadow Priest"]
						= "math.max(SHADOWDMG,SPELLPOWER)+CR_CRIT/6.14+INT/70*3.85+SPI/10*1.1+CR_HASTE*.535+CR_HIT+MANAREG*4/10*1.1+5*EMPTY_SOCKET_BLUE+9*EMPTY_SOCKET_RED+4.2*EMPTY_SOCKET_YELLOW+40*EMPTY_SOCKET_META",
	["Shadow Priest Wand"]
						= "DPS*.25+math.max(SHADOWDMG,SPELLPOWER)+CR_CRIT/6.14+INT/70*3.85+SPI/10*1.1+CR_HASTE*.535+CR_HIT+MANAREG*4/10*1.1+5*EMPTY_SOCKET_BLUE+9*EMPTY_SOCKET_RED+4.2*EMPTY_SOCKET_YELLOW+40*EMPTY_SOCKET_META",
	["Hunter"]		= ".01*AC+.5*STR+AGI+.5*STA+1.15*CR_HIT+.85*CR_CRIT+.5*ATTACKPOWER+1.15*CR_EXPERTISE+CR_HASTE+.1*APR+.01*CR_RESILIENCE+.01*CR_DODGE+EMPTY_SOCKET_BLUE*7+EMPTY_SOCKET_RED*9+EMPTY_SOCKET_YELLOW*9+EMPTY_SOCKET_META*40",
	["Hunter Range"]
						= "DPS*7+.01*AC+.5*STR+AGI+.5*STA+1.15*CR_HIT+.85*CR_CRIT+.5*ATTACKPOWER+1.15*CR_EXPERTISE+CR_HASTE+.1*APR+.01*CR_RESILIENCE+.01*CR_DODGE+EMPTY_SOCKET_BLUE*7+EMPTY_SOCKET_RED*9+EMPTY_SOCKET_YELLOW*9+EMPTY_SOCKET_META*40",
	-- Inspired by http://pawnmod.trenchrats.com/viewtopic.php?t=61
	["Paladin"]		= ".9*DPS+.1*AC+1.5*STR+.6*AGI+.5*STA+.75*INT+.75*CR_HIT+.6*CR_CRIT+.75*ATTACKPOWER+1.15*CR_EXPERTISE+.8*CR_HASTE+.15*APR+.1*CR_RESILIENCE+.07*CR_DODGE+.07*CR_PARRY+.05*CR_DEFENSE+.7*CR_CRIT+.75*CR_HIT+.8*SPELLPOWER+.3*MANAREG+.03*BLOCKVALUE+.05*CR_BLOCK+1.4*EMPTY_SOCKET_BLUE+2.8*EMPTY_SOCKET_RED+2.3*EMPTY_SOCKET_YELLOW+12*EMPTY_SOCKET_META",
	-- Rogue stuff, mostly from http://shadowpanther.net/
	["Rogue Main Hand MAEP"]
						= ".001*AC+.55*STR+1.1*AGI+.01*STA+1.15*CR_HIT+.9*CR_CRIT +.5*ATTACKPOWER +1.25*CR_EXPERTISE+CR_HASTE   +.15*APR+.001*CR_RESILIENCE+.001*CR_DODGE+4*EMPTY_SOCKET_BLUE+9*EMPTY_SOCKET_RED +9*EMPTY_SOCKET_YELLOW+40*EMPTY_SOCKET_META+3*DPS+1.75*AVG_DMG",
	["Rogue Dagger MAEP"]
						= ".001*AC+.55*STR+1.1*AGI+.01*STA+1.15*CR_HIT+.9*CR_CRIT +.5*ATTACKPOWER +1.25*CR_EXPERTISE+CR_HASTE   +.15*APR+.001*CR_RESILIENCE+.001*CR_DODGE+4*EMPTY_SOCKET_BLUE+9*EMPTY_SOCKET_RED +9*EMPTY_SOCKET_YELLOW+40*EMPTY_SOCKET_META+3*DPS+2.5*AVG_DMG",
   ["Rogue Off Hand MAEP"]
   					= ".001*AC+.55*STR+1.1*AGI+.01*STA+1.15*CR_HIT+.9*CR_CRIT +.5*ATTACKPOWER +1.25*CR_EXPERTISE+CR_HASTE   +.15*APR+.001*CR_RESILIENCE+.001*CR_DODGE+4*EMPTY_SOCKET_BLUE+9*EMPTY_SOCKET_RED +9*EMPTY_SOCKET_YELLOW+40*EMPTY_SOCKET_META+8*OH_SPEED_COEF+2*DPS",
	["Rogue Main Hand AEP"]
						= ".001*AC+.55*STR+1.1*AGI+.01*STA+1.15*CR_HIT+.9*CR_CRIT +.5*ATTACKPOWER +1.25*CR_EXPERTISE+CR_HASTE   +.15*APR+.001*CR_RESILIENCE+.001*CR_DODGE+4*EMPTY_SOCKET_BLUE+9*EMPTY_SOCKET_RED +9*EMPTY_SOCKET_YELLOW+40*EMPTY_SOCKET_META+1*DPS+2.5*AVG_DMG",
	["Rogue Dagger AEP"]
						= ".001*AC+.55*STR+1.1*AGI+.01*STA+1.15*CR_HIT+.9*CR_CRIT +.5*ATTACKPOWER +1.25*CR_EXPERTISE+CR_HASTE   +.15*APR+.001*CR_RESILIENCE+.001*CR_DODGE+4*EMPTY_SOCKET_BLUE+9*EMPTY_SOCKET_RED +9*EMPTY_SOCKET_YELLOW+40*EMPTY_SOCKET_META+1*DPS+3.6*AVG_DMG",
   ["Rogue Off Hand AEP"]
   					= ".001*AC+.55*STR+1.1*AGI+.01*STA+1.15*CR_HIT+.9*CR_CRIT +.5*ATTACKPOWER +1.25*CR_EXPERTISE+CR_HASTE   +.15*APR+.001*CR_RESILIENCE+.001*CR_DODGE+4*EMPTY_SOCKET_BLUE+9*EMPTY_SOCKET_RED +9*EMPTY_SOCKET_YELLOW+40*EMPTY_SOCKET_META+8*OH_SPEED_COEF+2*DPS",

	-- From http://elitistjerks.com/f47/t20765-shaman_enhancement/ and http://theorycraft.narod.ru/
	["Shaman AEP"]	= "9.07*DPS*WEAPON_SPEED/2.6+.1*AC+2*STR+1.74*AGI+.5*STA+1.34*CR_HIT+1.97*CR_CRIT+ATTACKPOWER+2.48*CR_EXPERTISE+1.28*CR_HASTE+.22*APR+.1*CR_RESILIENCE+.1*CR_DODGE+10*EMPTY_SOCKET_BLUE+16*EMPTY_SOCKET_RED+11.76*EMPTY_SOCKET_YELLOW+EMPTY_SOCKET_META*40",
	["Shaman OH AEP"]
						= "3.7*DPS*WEAPON_SPEED/2.6+.1*AC+2*STR+1.74*AGI+.5*STA+1.34*CR_HIT+1.97*CR_CRIT+ATTACKPOWER+2.48*CR_EXPERTISE+1.28*CR_HASTE+.22*APR+.1*CR_RESILIENCE+.1*CR_DODGE+10*EMPTY_SOCKET_BLUE+16*EMPTY_SOCKET_RED+11.76*EMPTY_SOCKET_YELLOW+EMPTY_SOCKET_META*40",

--9.03*DPS*WEAPON_SPEED/2.6+.1*AC+2*STR+.99*AGI+.25*STA+1.51*CR_HIT+1.12*CR_CRIT+ATTACKPOWER+1.62*CR_EXPERTISE+0.9*CR_HASTE+.11*APR+.1*CR_RESILIENCE+.1*CR_DODGE+10*EMPTY_SOCKET_BLUE+16*EMPTY_SOCKET_RED+11.76*EMPTY_SOCKET_YELLOW+EMPTY_SOCKET_META*40
--3.7*DPS*WEAPON_SPEED/2.6 +.1*AC+2*STR+.99*AGI+.25*STA+1.51*CR_HIT+1.12*CR_CRIT+ATTACKPOWER+1.62*CR_EXPERTISE+0.9*CR_HASTE+.11*APR+.1*CR_RESILIENCE+.1*CR_DODGE+10*EMPTY_SOCKET_BLUE+16*EMPTY_SOCKET_RED+11.76*EMPTY_SOCKET_YELLOW+EMPTY_SOCKET_META*40
   ["Shaman AEP PvP"]
   					= "",
   ["Shaman OH AEP PvP"]
   					= "",

   -- Inspired by http://pawnmod.trenchrats.com/viewtopic.php?t=23
   ["Warrior Fury"]
   					= "7*DPS+.01*AC+STR+.4*AGI+.25*STA+.5*CR_HIT+.6*CR_CRIT+.5*ATTACKPOWER+1.15*CR_EXPERTISE+.8*CR_HASTE+.14*APR+.1*CR_RESILIENCE+.1*CR_DODGE+EMPTY_SOCKET_BLUE*4+EMPTY_SOCKET_RED*8+EMPTY_SOCKET_YELLOW*6.3+EMPTY_SOCKET_META*23",
	["Warlock"]		= "3*AGI+10*INT+3*SPI+3*STA+ARMOR/5+10*SPELLPOWER+10*CR_CRIT+10*CR_HIT+10*CR_HASTE+10*SPELLPEN",
   -- Inspired by http://www.wowmb.net/forums/showthread.php?t=15357
	["Warlock2"]	= ".25*DPS+.95*SHADOWDMG+SPELLPOWER+.65*CR_HIT+.85*STA+.5*CR_CRIT+.5*CR_HASTE+.4*INT+.2*SPELLPEN+.1*CR_RESILIENCE+.1*SPI+10*EMPTY_SOCKET_BLUE+16*EMPTY_SOCKET_RED+11.76*EMPTY_SOCKET_YELLOW+EMPTY_SOCKET_META*15",
}


AC_Formula_to_Use = {
	[AC_MAGE] 			= { [DEFAULT] 							= "Mage",
								 ["INVTYPE_RANGEDRIGHT"]		= "Mage Wand",
	},
	[AC_PRIEST]			= { [DEFAULT] 							= "Shadow Priest",
								 ["INVTYPE_RANGEDRIGHT"]		= "Shadow Priest Wand",
	},
	[AC_WARLOCK]		= { [DEFAULT] 							= "Warlock2" },
	[AC_DRUID]			= { [DEFAULT] 							= "Druid Feral DPS" },
	[AC_ROGUE]			= { [DEFAULT] 							= "Rogue Main Hand AEP",
--								 ["INVTYPE_WEAPONMAINHAND"]	= "Rogue Main Hand AEP",
								 ["INVTYPE_WEAPONOFFHAND"]		= "Rogue Off Hand AEP",
	},
	[AC_HUNTER]			= { [DEFAULT] 							= "Hunter",
								 ["INVTYPE_RANGED"]				= "Hunter Range",
								 ["INVTYPE_RANGEDRIGHT"]		= "Hunter Range",
	},
	[AC_SHAMAN]			= { [DEFAULT] 							= "Shaman AEP",
								 ["INVTYPE_WEAPONOFFHAND"]		= "Shaman OH AEP",
	},
	[AC_PALADIN]		= { [DEFAULT] 							= "Paladin" },
	[AC_WARRIOR]		= { [DEFAULT] 							= "Warrior Fury" },
	[AC_DEATHKNIGHT]	= { [DEFAULT] 							= "Death Knight : Unholy" },
}

-- Item use text
AC_ENG    = 'Engineering'
AC_ARMOR  = 'Armor'
AC_WEAPON = 'Weapon'
AC_MELEE  = 'Melee'
AC_GUN    = 'Gun'
AC_GUNS   = 'Guns'
AC_DEVICE = 'Devices'
AC_MISC   = 'Miscellaneous'
AC_FISH   = 'Fishing Poles'
AC_1H     = {f='One%-Handed',r='1-H'}
AC_2H     = {f='Two%-Handed',r='2-H'}
AC_SHOOT  = {[AC_HUNTER]=1; [AC_ROGUE]=1; [AC_WARRIOR]=1}
AC_MAGIC  = {[AC_MAGE]=1; [AC_PRIEST]=1; [AC_WARLOCK]=1}
--[[ArmorCraft_Ranged = {Bows=AC_SHOOT; Crossbows=AC_SHOOT; [AC_GUNS]=AC_SHOOT; Wands=AC_MAGIC}

ArmorCraft_Melee = {
	 ["One-Handed Axes"]		={[AC_HUNTER]=1; [AC_PALADIN]=1; [AC_SHAMAN]=1; [AC_WARRIOR]=1};
    ["Two-Handed Axes"]		={[AC_HUNTER]=2; [AC_PALADIN]=2; [AC_WARRIOR]=2};
    ["One-Handed Maces"]	={[AC_DRUID]=1; [AC_PALADIN]=1; [AC_PRIEST]=1; [AC_ROGUE]=1; [AC_SHAMAN]=1; [AC_WARRIOR]=1};
    ["Two-Handed Maces"]	={[AC_DRUID]=2; [AC_PALADIN]=2; [AC_WARRIOR]=2};
    ["Polearms"]				={[AC_HUNTER]=2; [AC_PALADIN]=2; [AC_WARRIOR]=2};
    ["One-Handed Swords"]	={[AC_HUNTER]=1; [AC_MAGE]=1; [AC_PALADIN]=1; [AC_ROGUE]=1; [AC_WARLOCK]=1; [AC_WARRIOR]=1};
    ["Two-Handed Swords"]	={[AC_HUNTER]=2; [AC_PALADIN]=2; [AC_WARRIOR]=2};
    ["Staves"]					={[AC_DRUID]=2; [AC_HUNTER]=2; [AC_MAGE]=2; [AC_PRIEST]=2; [AC_SHAMAN]=2; [AC_WARLOCK]=2;
    					      	  [AC_WARRIOR]=2};
    ["Fist Weapons"]			={[AC_DRUID]=1; [AC_HUNTER]=1; [AC_ROGUE]=1; [AC_SHAMAN]=1; [AC_WARRIOR]=1};
    ["Daggers"]				={[AC_DRUID]=1; [AC_HUNTER]=1; [AC_MAGE]=1; [AC_PRIEST]=1;
                 			     [AC_ROGUE]=1; [AC_SHAMAN]=1; [AC_WARLOCK]=1; [AC_WARRIOR]=1}
}
ArmorCraft_OffHand = {
	 ["One-Handed Axes"]		={[AC_HUNTER]=1; [AC_SHAMAN]=1; [AC_WARRIOR]=1};
    ["One-Handed Maces"]	={[AC_ROGUE]=1; [AC_SHAMAN]=1; [AC_WARRIOR]=1};
    ["One-Handed Swords"]	={[AC_HUNTER]=1; [AC_ROGUE]=1; [AC_WARRIOR]=1};
    ["Fist Weapons"]			={[AC_HUNTER]=1; [AC_ROGUE]=1; [AC_SHAMAN]=1; [AC_WARRIOR]=1};
    ["Daggers"]				={[AC_HUNTER]=1; [AC_ROGUE]=1; [AC_SHAMAN]=1; [AC_WARRIOR]=1}
}
]]--

-- Weapon subtypes
AC_BOWS 					= "Bows"
AC_CROSSBOWS			= "Crossbows"
AC_DAGGERS				= "Daggers"
AC_GUNS					= "Guns"
AC_FISHING_POLES		= "Fishing Poles"
AC_FIST_WEAPONS		= "Fist Weapons"
AC_MISCELLANEOUS		= "Miscellaneous"
AC_1H_AXES				= "One-Handed Axes"
AC_1H_MACES				= "One-Handed Maces"
AC_1H_SWORDS			= "One-Handed Swords"
AC_POLEARMS				= "Polearms"
AC_STAVES				= "Staves"
AC_THROWN				= "Thrown"
AC_2H_AXES				= "Two-Handed Axes"
AC_2H_MACES				= "Two-Handed Maces"
AC_2H_SWORDS			= "Two-Handed Swords"
AC_WANDS					= "Wands"


ArmorCraft_CanUse = {
	[AC_DEATHKNIGHT]		= {
								-- SubType       		MinLevel
							[AC_ARMOR] = {
								[AC_CLOTH] 				= 1,
								[AC_LEATHER] 			= 1,
								[AC_SHIELDS] 			= 999,
								[AC_MAIL]				= 1,
								[AC_PLATE]				= 1,
								[AC_LIBRAMS]			= 999,
								[AC_IDOLS]				= 1,
								[AC_TOTEMS]				= 999,
								[AC_HELD]				= 1,
								[AC_MISCELLANEOUS]	= 1,
					    	},
							[AC_WEAPON] = {
								[AC_1H_AXES]			= 1,
								[AC_DAGGERS]			= 1,
								[AC_FIST_WEAPONS]		= 1,
								[AC_1H_MACES]			= 1,
								[AC_POLEARMS]			= 1,
								[AC_STAVES]				= 1,
								[AC_1H_SWORDS]			= 1,
								[AC_2H_AXES]			= 1,
								[AC_2H_MACES]			= 1,
								[AC_2H_SWORDS]			= 1,
								[AC_BOWS]				= 999,
								[AC_CROSSBOWS]			= 999,
								[AC_GUNS]				= 999,
								[AC_THROWN]				= 999,
								[AC_WANDS]				= 999,
								[AC_FISHING_POLES]	= 1,
								[AC_MISCELLANEOUS]	= 999,
					    	},
	},
	[AC_DRUID]		= {
								-- SubType       		MinLevel
							[AC_ARMOR] = {
								[AC_CLOTH] 				= 1,
								[AC_LEATHER] 			= 1,
								[AC_SHIELDS] 			= 999,
								[AC_MAIL]				= 999,
								[AC_PLATE]				= 999,
								[AC_LIBRAMS]			= 999,
								[AC_IDOLS]				= 1,
								[AC_TOTEMS]				= 999,
								[AC_HELD]				= 1,
								[AC_MISCELLANEOUS]	= 1,
					    	},
							[AC_WEAPON] = {
								[AC_1H_AXES]			= 999,
								[AC_DAGGERS]			= 1,
								[AC_FIST_WEAPONS]		= 1,
								[AC_1H_MACES]			= 1,
								[AC_POLEARMS]			= 999,
								[AC_STAVES]				= 1,
								[AC_1H_SWORDS]			= 999,
								[AC_2H_AXES]			= 999,
								[AC_2H_MACES]			= 1,
								[AC_2H_SWORDS]			= 999,
								[AC_BOWS]				= 999,
								[AC_CROSSBOWS]			= 999,
								[AC_GUNS]				= 999,
								[AC_THROWN]				= 999,
								[AC_WANDS]				= 999,
								[AC_FISHING_POLES]	= 1,
								[AC_MISCELLANEOUS]	= 999,
					    	},
	},
	[AC_HUNTER]		= {
							[AC_ARMOR] = {
								[AC_CLOTH] 				= 1,
								[AC_LEATHER] 			= 1,
								[AC_SHIELDS] 			= 999,
								[AC_MAIL]				= 40,
								[AC_PLATE]				= 999,
								[AC_LIBRAMS]			= 999,
								[AC_IDOLS]				= 999,
								[AC_TOTEMS]				= 999,
								[AC_HELD]				= 1,
								[AC_MISCELLANEOUS]	= 1,
					    	},
							[AC_WEAPON] = {
								[AC_1H_AXES]			= 1,
								[AC_DAGGERS]			= 1,
								[AC_FIST_WEAPONS]		= 1,
								[AC_1H_MACES]			= 999,
								[AC_POLEARMS]			= 1,
								[AC_STAVES]				= 1,
								[AC_1H_SWORDS]			= 1,
								[AC_2H_AXES]			= 1,
								[AC_2H_MACES]			= 999,
								[AC_2H_SWORDS]			= 1,
								[AC_BOWS]				= 1,
								[AC_CROSSBOWS]			= 1,
								[AC_GUNS]				= 1,
								[AC_THROWN]				= 1,
								[AC_WANDS]				= 999,
								[AC_FISHING_POLES]	= 1,
								[AC_MISCELLANEOUS]	= 999,
					    	},
	},
	[AC_MAGE] 		= {
							[AC_ARMOR] = {
								[AC_CLOTH] 				= 1,
								[AC_LEATHER] 			= 999,
								[AC_SHIELDS] 			= 999,
								[AC_MAIL]				= 999,
								[AC_PLATE]				= 999,
								[AC_LIBRAMS]			= 999,
								[AC_IDOLS]				= 999,
								[AC_TOTEMS]				= 999,
								[AC_HELD]				= 1,
								[AC_MISCELLANEOUS]	= 1,
					    	},
							[AC_WEAPON] = {
								[AC_1H_AXES]			= 999,
								[AC_DAGGERS]			= 1,
								[AC_FIST_WEAPONS]		= 999,
								[AC_1H_MACES]			= 999,
								[AC_POLEARMS]			= 999,
								[AC_STAVES]				= 1,
								[AC_1H_SWORDS]			= 1,
								[AC_2H_AXES]			= 999,
								[AC_2H_MACES]			= 999,
								[AC_2H_SWORDS]			= 999,
								[AC_BOWS]				= 999,
								[AC_CROSSBOWS]			= 999,
								[AC_GUNS]				= 999,
								[AC_THROWN]				= 999,
								[AC_WANDS]				= 1,
								[AC_FISHING_POLES]	= 1,
								[AC_MISCELLANEOUS]	= 999,
					    	},
	},
	[AC_PALADIN]	= {
							[AC_ARMOR] = {
								[AC_CLOTH] 				= 1,
								[AC_LEATHER] 			= 1,
								[AC_SHIELDS] 			= 1,
								[AC_MAIL]				= 1,
								[AC_PLATE]				= 40,
								[AC_LIBRAMS]			= 1,
								[AC_IDOLS]				= 999,
								[AC_TOTEMS]				= 999,
								[AC_HELD]				= 1,
								[AC_MISCELLANEOUS]	= 1,
					    	},
							[AC_WEAPON] = {
								[AC_1H_AXES]			= 1,
								[AC_DAGGERS]			= 999,
								[AC_FIST_WEAPONS]		= 999,
								[AC_1H_MACES]			= 1,
								[AC_POLEARMS]			= 20,
								[AC_STAVES]				= 999,
								[AC_1H_SWORDS]			= 1,
								[AC_2H_AXES]			= 1,
								[AC_2H_MACES]			= 1,
								[AC_2H_SWORDS]			= 1,
								[AC_BOWS]				= 999,
								[AC_CROSSBOWS]			= 999,
								[AC_GUNS]				= 999,
								[AC_THROWN]				= 999,
								[AC_WANDS]				= 999,
								[AC_FISHING_POLES]	= 1,
								[AC_MISCELLANEOUS]	= 999,
					    	},
	},
	[AC_PRIEST]		= {
							[AC_ARMOR] = {
								[AC_CLOTH] 				= 1,
								[AC_LEATHER] 			= 999,
								[AC_SHIELDS] 			= 999,
								[AC_MAIL]				= 999,
								[AC_PLATE]				= 999,
								[AC_LIBRAMS]			= 999,
								[AC_IDOLS]				= 999,
								[AC_TOTEMS]				= 999,
								[AC_HELD]				= 1,
								[AC_MISCELLANEOUS]	= 1,
					    	},
							[AC_WEAPON] = {
								[AC_1H_AXES]			= 999,
								[AC_DAGGERS]			= 1,
								[AC_FIST_WEAPONS]		= 999,
								[AC_1H_MACES]			= 1,
								[AC_POLEARMS]			= 999,
								[AC_STAVES]				= 1,
								[AC_1H_SWORDS]			= 999,
								[AC_2H_AXES]			= 999,
								[AC_2H_MACES]			= 999,
								[AC_2H_SWORDS]			= 999,
								[AC_BOWS]				= 999,
								[AC_CROSSBOWS]			= 999,
								[AC_GUNS]				= 999,
								[AC_THROWN]				= 999,
								[AC_WANDS]				= 1,
								[AC_FISHING_POLES]	= 1,
								[AC_MISCELLANEOUS]	= 999,
					    	},
	},
	[AC_ROGUE]		= {
							[AC_ARMOR] = {
								[AC_CLOTH] 				= 1,
								[AC_LEATHER] 			= 1,
								[AC_SHIELDS] 			= 999,
								[AC_MAIL]				= 999,
								[AC_PLATE]				= 999,
								[AC_LIBRAMS]			= 999,
								[AC_IDOLS]				= 999,
								[AC_TOTEMS]				= 999,
								[AC_HELD]				= 1,
								[AC_MISCELLANEOUS]	= 1,
					    	},
							[AC_WEAPON] = {
								[AC_1H_AXES]			= 999,
								[AC_DAGGERS]			= 1,
								[AC_FIST_WEAPONS]		= 1,
								[AC_1H_MACES]			= 1,
								[AC_POLEARMS]			= 999,
								[AC_STAVES]				= 999,
								[AC_1H_SWORDS]			= 1,
								[AC_2H_AXES]			= 999,
								[AC_2H_MACES]			= 999,
								[AC_2H_SWORDS]			= 999,
								[AC_BOWS]				= 1,
								[AC_CROSSBOWS]			= 1,
								[AC_GUNS]				= 1,
								[AC_THROWN]				= 1,
								[AC_WANDS]				= 999,
								[AC_FISHING_POLES]	= 1,
								[AC_MISCELLANEOUS]	= 999,
					    	},
	},
	[AC_SHAMAN]		= {
							[AC_ARMOR] = {
								[AC_CLOTH] 				= 1,
								[AC_LEATHER] 			= 1,
								[AC_SHIELDS] 			= 1,
								[AC_MAIL]				= 40,
								[AC_PLATE]				= 999,
								[AC_LIBRAMS]			= 999,
								[AC_IDOLS]				= 999,
								[AC_TOTEMS]				= 1,
								[AC_HELD]				= 1,
								[AC_MISCELLANEOUS]	= 1,
					    	},
							[AC_WEAPON] = {
								[AC_1H_AXES]			= 1,
								[AC_DAGGERS]			= 1,
								[AC_FIST_WEAPONS]		= 1,
								[AC_1H_MACES]			= 1,
								[AC_POLEARMS]			= 999,
								[AC_STAVES]				= 1,
								[AC_1H_SWORDS]			= 999,
								[AC_2H_AXES]			= 20,
								[AC_2H_MACES]			= 20,
								[AC_2H_SWORDS]			= 999,
								[AC_BOWS]				= 999,
								[AC_CROSSBOWS]			= 999,
								[AC_GUNS]				= 999,
								[AC_THROWN]				= 999,
								[AC_WANDS]				= 999,
								[AC_FISHING_POLES]	= 1,
								[AC_MISCELLANEOUS]	= 999,
					    	},
	},
	[AC_WARLOCK]	= {
							[AC_ARMOR] = {
								[AC_CLOTH] 				= 1,
								[AC_LEATHER] 			= 999,
								[AC_SHIELDS] 			= 999,
								[AC_MAIL]				= 999,
								[AC_PLATE]				= 999,
								[AC_LIBRAMS]			= 999,
								[AC_IDOLS]				= 999,
								[AC_TOTEMS]				= 999,
								[AC_HELD]				= 1,
								[AC_MISCELLANEOUS]	= 1,
					    	},
							[AC_WEAPON] = {
								[AC_1H_AXES]			= 999,
								[AC_DAGGERS]			= 1,
								[AC_FIST_WEAPONS]		= 999,
								[AC_1H_MACES]			= 999,
								[AC_POLEARMS]			= 999,
								[AC_STAVES]				= 1,
								[AC_1H_SWORDS]			= 1,
								[AC_2H_AXES]			= 999,
								[AC_2H_MACES]			= 999,
								[AC_2H_SWORDS]			= 999,
								[AC_BOWS]				= 999,
								[AC_CROSSBOWS]			= 999,
								[AC_GUNS]				= 999,
								[AC_THROWN]				= 999,
								[AC_WANDS]				= 1,
								[AC_FISHING_POLES]	= 1,
								[AC_MISCELLANEOUS]	= 999,
					    	},
	},
	[AC_WARRIOR]	= {
							[AC_ARMOR] = {
								[AC_CLOTH] 				= 1,
								[AC_LEATHER] 			= 1,
								[AC_SHIELDS] 			= 1,
								[AC_MAIL]				= 1,
								[AC_PLATE]				= 40,
								[AC_LIBRAMS]			= 999,
								[AC_IDOLS]				= 999,
								[AC_TOTEMS]				= 999,
								[AC_HELD]				= 1,
								[AC_MISCELLANEOUS]	= 1,
					    	},
							[AC_WEAPON] = {
								[AC_1H_AXES]			= 1,
								[AC_DAGGERS]			= 1,
								[AC_FIST_WEAPONS]		= 1,
								[AC_1H_MACES]			= 1,
								[AC_POLEARMS]			= 20,
								[AC_STAVES]				= 1,
								[AC_1H_SWORDS]			= 1,
								[AC_2H_AXES]			= 1,
								[AC_2H_MACES]			= 1,
								[AC_2H_SWORDS]			= 1,
								[AC_BOWS]				= 1,
								[AC_CROSSBOWS]			= 1,
								[AC_GUNS]				= 1,
								[AC_THROWN]				= 1,
								[AC_WANDS]				= 999,
								[AC_FISHING_POLES]	= 1,
								[AC_MISCELLANEOUS]	= 999,
					    	},
	},
}

ArmorCraft_EquipWhere = {
--	"INVTYPE_AMMO"					= {0},
	["INVTYPE_HEAD"]           = {1},
	["INVTYPE_NECK"]				= {2},
	["INVTYPE_SHOULDER"]			= {3},
--	["INVTYPE_BODY"]				= {4},
	["INVTYPE_CHEST"]				= {5},
	["INVTYPE_ROBE"]				= {5},
	["INVTYPE_WAIST"]				= {6},
	["INVTYPE_LEGS"]				= {7},
	["INVTYPE_FEET"]				= {8},
	["INVTYPE_WRIST"]				= {9},
	["INVTYPE_HAND"]				= {10},
	["INVTYPE_FINGER"]			= {11,12},
	["INVTYPE_TRINKET"]			= {13,14},
	["INVTYPE_CLOAK"]				= {15},
	["INVTYPE_WEAPON"]			= {16,17},
	["INVTYPE_SHIELD"]			= {17},
	["INVTYPE_2HWEAPON"]			= {16},
	["INVTYPE_WEAPONMAINHAND"]	= {16},
	["INVTYPE_WEAPONOFFHAND"]	= {17},
	["INVTYPE_HOLDABLE"]			= {17},
	["INVTYPE_RANGED"]			= {18},
	["INVTYPE_THROWN"]			= {18},
	["INVTYPE_RANGEDRIGHT"]		= {18},
	["INVTYPE_RELIC"]				= {18},
--	"INVTYPE_TABARD"				= {19},
--	"INVTYPE_BAG"					= {20,21,22,23},
--	"INVTYPE_QUIVER"  			= {20,21,22,23},
}

ArmorCraft_SlotName = {
	[1]	= 'Head',
	[2]	= 'Neck',
	[3]	= 'Shoulder',
	[5]	= 'Chest',
	[6]	= 'Waist',
	[7]	= 'Legs',
	[8]	= 'Feet',
	[9]	= 'Wrist',
	[10]	= 'Hands',
	[11]	= 'Finger',
	[12]	= 'Finger',
	[13]	= 'Trinket',
	[14]	= 'Trinket',
	[15]	= 'Back',
	[16]	= 'Main Hand',
	[17]	= 'Off Hand',
	[18]	= 'Ranged',
}

-- Messages
ARMORCRAFT_NOWINDOW 	= "No trade skill window open."
ARMORCRAFT_NOTARMOR 	= " does not craft armor."
ARMORCRAFT_BADLEVEL 	= "Level must be between 1 and 70."
ARMORCRAFT_NOSELECT 	= "No selection for "
ARMORCRAFT_NOCLASS  	= "No character class selected."
ARMORCRAFT_NOITEM   	= "No craft item selected."
ARMORCRAFT_CLASS    	= "Attribute values for %s class."
ARMORCRAFT_RESET    	= " value reset."
ARMORCRAFT_SKIP     	= "Skipping craft selection "
ARMORCRAFT_EMPTY    	= "Empty item value cache."
ARMORCRAFT_BADFORMAT	= "Bad value format: "
ARMORCRAFT_UNDEFINED	= "Undefined name: "
ARMORCRAFT_WRONG    	= "Wrong item type to compare : "
ARMORCRAFT_ACTIP    	= "Click to toggle ArmorCraft windows."
ARMORCRAFT_USETIP   	= "Click to compare the selected item."
ARMORCRAFT_PARTYTIP 	= "Click to toggle Party members."
ARMORCRAFT_DELETECACHE
							= "Deleting all cached values"
ARMORCRAFT_INVALIDLINK
							= "not a valid itemLink: "
ARMORCRAFT_RESET		= "Reseting the formulas to their default values"
AC_PARTY  				= "Party"
AC_LEVEL  				= "Level"
AC_CLASS  				= "Class"
AC_SELECT 				= "Select"

-- Tooltip text
ARMORCRAFT_BOE              = "Binds when equipped"
ARMORCRAFT_BOP              = "Binds when picked up"
ARMORCRAFT_BOU              = "Binds when used"
ARMORCRAFT_SOULBOUND        = "Soulbound"
ARMORCRAFT_UNIQUE           = "Unique"
ARMORCRAFT_UNIQUE_EQUIPPED  = "Unique-Equipped"
ARMORCRAFT_ARMOR            = "^(%d+) Armor"
ARMORCRAFT_REQUIRES         = "^Requires Level (%d+)"
ARMORCRAFT_DPS              = "^%((%d+%.%d) damage per second%)"

-- Shorter descriptions
AC_ShortDesc = {
	[AC_HELD]		= AC_OFF,
	[AC_1H_AXES]	= "1-H Axes",
	[AC_1H_MACES]	= "1-H Maces",
	[AC_1H_SWORDS]	= "1-H Swords",
	[AC_2H_AXES]	= "2-H Axes",
	[AC_2H_MACES]	= "2-H Maces",
	[AC_2H_SWORDS]	= "2-H Swords",
}

-- Help text
AC_Help = { ['?'] = 'Armorcraft';
	ac = { ['?'] = "The main chat command",
			 [''] = "Toggle the ArmorCraft window",
			 ['<name>'] = "Change the AC target to <name>",
			 ['reset'] = "Reset the formulas to the default values",
	};
	acv = { ['?'] = "Manage custom values",
			  [''] = "Display the attribute values for the current class",
			  default = "Reset the formulas to the default values",
			  list = "List the custom armor values",
			  ['0'] = "Delete the custom armor value for the current craft item",
			  ['<value>'] = "Set the custom armor value for the current craft item",
			  ['<attr>=<value>'] = "Sets <attr> weighting to <value>", };
	}

-- Test options
AC_test_option_test = ".9*DPS+.1*(ARMOR+BASE_ARMOR)+1.5*STR+.6*AGI+.5*STA+.75*INT+.75*CR_HIT+.6*CR_CRIT+.75*ATTACKPOWER+1.15*CR_EXPERTISE+.8*CR_HASTE+.15*APR+.1*CR_RESILIENCE+.07*CR_DODGE+.07*CR_PARRY+.05*CR_DEFENSE+.7*CR_CRIT+.75*CR_HIT+.8*SPELLPOWER+.3*MANAREG+.03*BLOCKVALUE+.05*CR_BLOCK+1.4*EMPTY_SOCKET_BLUE+2.8*EMPTY_SOCKET_RED+2.3*EMPTY_SOCKET_YELLOW+12*EMPTY_SOCKET_META"
AC_test_option_test2 = "12345678901234567890123456789012345678901234567890"

